import CocosHelper from "../TFrame/script/helper/CocosHelper";
import GameLogicController from "./game/GameLogicController";
import StatusProperties from "./game/StatusProperties";
import IconFramesMgr from "./IconFramesMgr";
import NativeCaller from "./NativeCaller";
import { ActionType } from "./net/Enum";
import ServiceLogic from "./net/ServerLogic";
import PlayerDataMgr from "./PlayerDataMgr";
import ResManager from "./ResManager";
import Util from "../../StartAb/Util";
import WXAD from "../../StartAb/WXAd";

const { ccclass, property } = cc._decorator;

@ccclass
export default class SettingLayer extends cc.Component {

    protected onEnable(): void {
        WXAD.instance.showBanner()
    }

    protected onDisable(): void {
        WXAD.instance.hideBanner();
    }

    onLoad() {

    }

    start() {

    }

    home(e: cc.Event.EventTouch) {
        CocosHelper.disableButton(e);
        if (PlayerDataMgr.isADVideo) {
            IconFramesMgr.getInstance().loadIcons(() => {
                Util.changeScene("levelList_ad");
                cc.log('icon load done');
            })
        } else {
            Util.changeScene("Home");
        }
        let bgResName = ResManager.getLevelResNameByIndex(ResManager.currentLevelIndex);
        ServiceLogic.action(ActionType.ActionBackHome, { "beiz": bgResName + ":" + GameLogicController.getInstance().foundCount })
        // this.showFull()
    }

    back(e: cc.Event.EventTouch) {
        CocosHelper.disableButton(e);
        this.node.destroy();
    }

    more(e: cc.Event.EventTouch) {

    }
}
